package microcredit.gui.base;

import java.text.DateFormat;
import java.text.ParseException;
import java.util.Date;

import org.jdesktop.beansbinding.Converter;

public class BirthdateConverter extends Converter<Date, String> {

	private DateFormat format = DateFormat.getDateInstance(DateFormat.SHORT);
	
	@Override
	public Date convertReverse(String value) {
		try {
			return format.parse(value);
		} catch (ParseException e) {
			return null;
		}
	}

	@Override
	public String convertForward(Date value) {
		return format.format(value);
	}

}